package com.atguigu.guli.service.edu.controller;


import com.atguigu.guli.service.edu.entity.Teacher;
import com.atguigu.guli.service.edu.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 讲师 前端控制器
 * </p>
 *
 * @author leo
 * @since 2021-11-24
 */
@RestController
@RequestMapping("/edu/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService ;
    //查询所有讲师
    @GetMapping("list")
    public List<Teacher> teacherList() {
        return teacherService.list() ;
    }

    //新增讲师
    @PostMapping("save")
    public String save(@RequestBody Teacher teacher) {
        return teacherService.save(teacher) ? "新增讲师成功":"新增讲师失败" ;
    }
}

